package com.cn.enums;

import jdk.internal.dynalink.NoSuchDynamicMethodException;

/**
 * &#064;Time 2024 八月 星期日 01:21
 *
 * @author ShangGuan
 */
public enum FileEnum {

    TEXT{
        @Override
        public String getFileContentType(){
            return "Content-Type: text/plain";
        }
    },
    XML{
        @Override
        public String getFileContentType(){
            return "Content-Type: application/xml";
        }
    },
    XLSX{
        @Override
        public String getFileContentType(){
            return "Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        }
    },
    ;


    public String getFileContentType(){
        throw new NoSuchDynamicMethodException("No Method");
    }

    public static FileEnum getInstance(String fileSuffix){
        if(fileSuffix.equals("text")){
            return TEXT;
        }else if(fileSuffix.equals("xml")){
            return XML;
        }else if(fileSuffix.equals("xlsx")){
            return XLSX;
        }else {
            return TEXT;
        }
    }
}
